﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OptikinetiqControls
{
    public partial class Light : UserControl
    {
        private bool _lightStatus;
        [Description("状态灯是否打开"), Category("自定义属性"),Browsable(true)]
        public bool LightStatus {
            get { return _lightStatus; }
            set {
                _lightStatus = value;
                if (_lightStatus)
                {
                    panel_light.BackColor = this._enableColor;
                }
                else {
                    panel_light.BackColor = this._disableColor;
                }
            }
        }
        [Description("状态灯打开颜色"), Category("自定义属性"), Browsable(true)]
        private Color _enableColor;
        public Color EnableColor
        {
            get { return _enableColor; }
            set { _enableColor = value; }
        }
        [Description("状态灯关闭颜色"), Category("自定义属性"), Browsable(true)]
        private Color _disableColor;
        public Color DisableColor {
            get { return _disableColor; }
            set { _disableColor = value; }
        }

        private string _info;
        [Description("状态灯提示信息"), Category("自定义属性"), Browsable(true)]
        public string Info {
            get { return _info; }
            set { 
                _info = value;
                label_info.Text = _info;
            }
        }

        public Light()
        {
            InitializeComponent();
        }
    }
}
